package com.kaifamiao.month03.day0310;

public class Officer {

    public static void main(String[] args) {
        Officer officer = new Officer();
        Person boy = new Person();
        Person girl = new Person();
        boy.name = "兰正亮";
        girl.name = "迪丽热巴";
        boy.gender = "男";
        girl.gender = "女";
        boy.age = 23;
        girl.age = 19;
        boy.isMarry = false;
        girl.isMarry = false;
        if (officer.marry(boy, girl)) {
            System.out.println("===Congratulations!===");
            System.out.println(boy.name + " 和 " + girl.name + "可以结婚！");
        }else {
            System.out.println("你在做梦吗？");
            System.out.println(boy.name + " 和 " + girl.name + "不可能会结婚！");
        }
    }
    /**
     *  判断两人是否可以结婚
     * @param bf 一个对象
     * @param gf 一个对象
     * @return 是否可以结婚 true 可以结婚 false 不可以结婚
     */
    public  boolean marry(Person bf, Person gf) {
        return "男".equals(bf.gender) && "女".equals(gf.gender) && bf.age >= 22 && gf.age >= 20
                && !gf.isMarry && !bf.isMarry;
    }
}
